import 'package:flutter/material.dart';
import 'package:flutter_app/demo/demo_page.dart';
import 'package:flutter_app/demo/home_page.dart';
import 'package:flutter_app/demo/tab_bar_demo.dart';
import 'package:go_router/go_router.dart';

import '../demo/sqlite_demo_page.dart';
import '../demo/network_demo_page.dart';
import '../demo/image_demo_page.dart';
import '../demo/video_demo_page.dart';

/// The route configuration.
final router = GoRouter(
  initialLocation: '/',
  routes: <RouteBase>[
    GoRoute(
      path: '/',
      builder: (BuildContext context, GoRouterState state) {
        return const HomePage(title: "主页");
      },
      routes: <RouteBase>[
        GoRoute(
          path: 'details',
          builder: (BuildContext context, GoRouterState state) {
            return const DemoPage();
          },
        ),
        GoRoute(
          path: 'tabBarDemo',
          builder: (BuildContext context, GoRouterState state) {
            return const TabBarDemo();
          },
        ),
        GoRoute(
          path: 'sqlite',
          builder: (BuildContext context, GoRouterState state) {
            return const SqliteDemoPage();
          },
        ),
        GoRoute(
          path: 'network',
          builder: (BuildContext context, GoRouterState state) {
            return const NetworkDemoPage();
          },
        ),
        GoRoute(
          path: 'image',
          builder: (BuildContext context, GoRouterState state) {
            return const ImageDemoPage();
          },
        ),
        GoRoute(
          path: 'video',
          builder: (BuildContext context, GoRouterState state) {
            return const VideoDemoPage();
          },
        ),
      ],
    ),
  ],
);
